package s3

import (
	"context"
	"github.com/rs/zerolog/log"
)

const (
	DefaultPrefix = "bench_data"
)

func (s *Storage) Run() error {
	if s.PutEnable {
		log.Info().Msg("start to put data")
		s.PutPrefix = DefaultPrefix
		s.DeletePrefix = DefaultPrefix
		err := s.PutData(context.Background())
		if err != nil {
			return err
		}
	}
	if s.DeleteEnable {
		log.Info().Msg("start to delete data")
		if s.DeletePrefix == "" {
			s.DeletePrefix = DefaultPrefix
		}
		err := s.RemoveMany(context.Background())
		if err != nil {
			return err
		}
	}
	return nil
}
